<template>
  <view class="my">
    <my-mj ref="mymj" :userinfo="userinfo"></my-mj>
    <logins ref="logins" @islogins="isloginFn"></logins>
  </view>
</template>

<script>
  import myMj from '@/pages/my/my_mj';
  import logins from '@/components/logins/login.vue';
  import useHttp from '@/utils/http.js';

  export default {
    components: {
      myMj,
      logins,
    },
    data() {
      return {
        memberData: 'mj',
        detailPage: null,
        userDpId: 0,
        userinfo: {},
        // 是否登录
        islogin: false,
      };
    },
    onShow: function () {
      this.getUserInfo();
    },
    onLoad() {},
    // 监听用户下拉动作，一般用于下拉刷新
    onPullDownRefresh() {
      this.getUserInfo();
    },
    methods: {
      async getUserInfo() {
        let res = await useHttp().get('/api/user/my');
        if (res.code == 200) {
          console.log('res', res);
          this.userinfo = res.data;
        }
      },
      // 登录成功返回的数据
      isloginFn(islogin, userInfo) {
        this.islogin = islogin;
        this.userInfo = userInfo;
        this.$refs.mymj.orderFns(true);
      },
    },
  };
</script>
<style scoped lang="scss">
  .my {
    .buts {
      width: 95%;
      padding: 0 2%;
      position: fixed;
      bottom: 0;
      left: 0;
      //#ifdef H5
      bottom: 55px;

      //#endif
      view {
        width: 100%;
        height: 100rpx;
        background: #ffffff;
        border-radius: 10px;
        font-size: 20px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 600;
        line-height: 100rpx;
        margin: 10px 0;
        text-align: center;
      }

      .switchover {
        color: $mainText;
      }

      .quit {
        color: #ff2929;
      }
    }
  }
</style>
